
(function($, win, doc){
	
	/**
	 *  默认值：/seeyon
	 */
	var appBasePath = (function(){
		
		var path = location.pathname;
		
		return path.substring(0, path.indexOf('/', 1));
	})();
	
	
	var app = new Vue({
		el: '#app',
		data: {
			basic:{
				
			},
			style:{
				
			},
			listData:[{
					id: null,
					name: '测试测试测试测试测试测试测试测试测试测试',
					code: 'JOBTASK_20211112160904562571',
					cron: '',
					description: '... ...',
					ts: '2021-01-01 00:00:00'
			}]
		},
		methods:{
			init: function(){
				
				this.loadListData();		
				
			},
			loadListData: function(){
				
				var _this = this;
				
				$.http.get({
					url: (appBasePath + '/snail/jobtask.do?method=list'),
					header: {'Accept': 'application/json'},
					onsuccess: function(result, status, xhr){
						
						if(200 == result.code){
							
							_this.listData = result.data;
							
						}else{
							alert(result.message);
						}

					},
					onerror: function(responseText, status, xhr){
						console.log(responseText);
					}
				});
			},
			onAdd: function(){
				
				win.parent.Snail.appLayout.openEditTabs(null);
			},
			onDelete: function(code){
				
				var _this = this;
				
				$.http.post({
					url: (appBasePath + '/snail/jobtask.do?method=delete'),
					header: {'Accept': 'application/json'},
					data: {code: code},
					onsuccess: function(result, status, xhr){
						
						alert(result.message);

						_this.loadListData();
					},
					onerror: function(responseText, status, xhr){
						console.log(responseText);
					}
				});
			},
			onEdit: function(code){
				
				win.parent.Snail.appLayout.openEditTabs(code);
			}
		},
		created: function(){
			this.init();
		}
	});
	
	
})(Snail, window, document);